<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="btnSend">点我</div>
    <div id="request-process-patent"></div>
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript">
        $("#btnSend").click(function() {
            $("#request-process-patent").html("正在提交数据，请勿关闭当前窗口...");
            $.ajax({
                type: "POST",
                url: "RequestData.ashx",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify(GetJsonData()),
                dataType: "json",
                success: function(message) {
                    if (message > 0) {
                        alert("请求已提交");
                    }
                },
                error: function(message) {
                    console.log(JSON.stringify(GetJsonData()));
                    console.log(typeof JSON.stringify(GetJsonData()));
                    console.log(typeof JSON.parse(GetJsonData()));

                    $("#request-process-patent").html("提交数据失败！");
                }
            });
        });

        function GetJsonData() {
            var json = {
                "childbirthday": "19940702",
                "childgender": "女",
                "childname": "tanyue",
                "customerid": "111",
                "num": "12",
                "regulatorid": "333",
                "type": "大学生"
            };
            return json;
        }
    </script>
</body>

</html>
